from sqlalchemy import create_engine

HOSTNAME = "127.0.0.1"
PORT = "3306"
DATABASE = "lxq_back"
USERNAME = "root"
PASSWORD = "12345678"

db_url = 'mysql+mysqlconnector://{username}:{password}@{hostname}:{port}/{database}?charset=utf8'.format(
    username=USERNAME,
    password=PASSWORD,
    hostname=HOSTNAME,
    port=PORT,
    database=DATABASE
)


engine = create_engine(db_url,echo=True)

if __name__ == '__main__':
    connection = engine.connect()
    result = connection.execute("select * from user")
    print(result.fetchone())
